﻿<!DOCTYPE html>
<html lang="en">
<#include "../include/resource-head.html"/>
<#assign active='userList'/>
<body>
<#include "../include/common-top.html"/>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
    <#include "../include/common-menu.html"/>
        <div class="main-content">
            <div class="page-content">
                <div class="col-xs-12">
                    <div class="row-fluid">
                        <div class="widget-box">
                            <div class="widget-header widget-header-blue widget-header-flat">
                                <h4 class="lighter">
                                    <i class="icon-leaf"></i>修改学生信息
                                </h4>
                            </div>
                            <div class="widget-body">
                                <div class="widget-main">
                                    <div class="step-content row-fluid position-relative">
                                        <form class="form-horizontal" action="/user/update" method="post" onsubmit="return form_submit()">
                                            <input type="hidden" name="id" value="${user.id}">
                                            <div class="form-group has-info">
                                                <label class="col-xs-12 col-sm-3 control-label no-padding-right">学号</label>
                                                <div class="col-xs-12 col-sm-5">
                                                    <input type="text" class="width-100 num" name="no" value="${user.no!}" <#if sessionUser.type = 'student'>disabled</#if> required/>
                                                </div>
                                            </div>
                                            <div class="form-group has-info">
                                                <label class="col-xs-12 col-sm-3 control-label no-padding-right">姓名</label>
                                                <div class="col-xs-12 col-sm-5">
                                                    <input type="text" class="width-100" name="name" required value="${user.name!}"  <#if sessionUser.type = 'student'>disabled</#if>/>
                                                </div>
                                            </div>
                                            <div class="form-group has-info">
                                                <label class="col-xs-12 col-sm-3 control-label no-padding-right">邮箱</label>
                                                <div class="col-xs-12 col-sm-5">
                                                    <input type="text" class="width-100" required name="email" value="${user.email!}" />
                                                </div>
                                            </div>

                                            <div class="form-group has-info">
                                                <label class="col-xs-12 col-sm-3 control-label no-padding-right">手机号</label>
                                                <div class="col-xs-12 col-sm-5">
                                                    <input type="text" class="width-100 num" name="phone" value="${user.phone!}" />
                                                </div>
                                            </div>

                                            <div class="form-group has-info">
                                                <label class="col-xs-12 col-sm-3 control-label no-padding-right">性别</label>
                                                <div class="col-xs-12 col-sm-5">
                                                    <select class="width-100" name="sex" <#if sessionUser.type = 'student'>disabled</#if>>
                                                        <option value="0" <#if 0==user.sex!0>selected</#if>>男</option>
                                                        <option value="1" <#if 1==user.sex!0>selected</#if>>女</option>
                                                    </select>
                                                </div>
                                            </div>

                                            <div class="form-group has-info">
                                                <label class="col-xs-12 col-sm-3 control-label no-padding-right">身份证</label>
                                                <div class="col-xs-12 col-sm-5">
                                                    <input type="text" class="width-100 " name="idcard" <#if sessionUser.type = 'student'>disabled</#if> value="${user.idcard!}" required />
                                                </div>
                                            </div>

                                            <div class="form-group has-info">
                                                <label class="col-xs-12 col-sm-3 control-label no-padding-right">学院</label>
                                                <div class="col-xs-12 col-sm-5">
                                                    <select class="width-100" name="college" <#if sessionUser.type = 'student'>disabled</#if>>
                                                        <option <#if user.college = '建筑学院'>selected</#if> value="建筑学院" >建筑学院</option>
                                                        <option <#if user.college = '计算机学院'>selected</#if> value="计算机学院" >计算机学院</option>
                                                        <option <#if user.college = '软件学院'>selected</#if> value="软件学院" >软件学院</option>
                                                        <option <#if user.college = '艺术学院'>selected</#if> value="艺术学院" >艺术学院</option>
                                                        <option <#if user.college = '理学院'>selected</#if> value="理学院" >理学院</option>
                                                        <option <#if user.college = '控制学院'>selected</#if> value="控制学院" >控制学院</option>
                                                    </select>
                                                    <input type="text" class="width-100" name="college"  value="${user.college!}" required/>
                                                </div>
                                            </div>

                                            <div class="form-group has-info">
                                                <label class="col-xs-12 col-sm-3 control-label no-padding-right">限制IP</label>
                                                <div class="col-xs-12 col-sm-5">
                                                    <input type="text" class="width-100" name="ip" <#if sessionUser.type = 'student'>disabled</#if> value="${user.ip!}" required/>
                                                </div>
                                            </div>
                                            <hr/>
                                            <div class="row-fluid wizard-actions">
                                                <button class="btn" type="reset">重置</button>
                                                <button class="btn btn-success" type="submit">提交</button>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /.page-content -->
        </div>
        <!-- /.main-content -->
    </div>
    <!-- /.main-container -->
</body>
<#include "../include/resource-script.html"/>
<script>
    var phoneReg =/^1[3|4|7|5|8][0-9]{9}$/;
    var cardReg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;

    function form_submit() {
        var phone = $("input[name='phone']").val();
        var idcard = $("input[name='phone']").val();
        if(!phoneReg.test(phone)){
            tipMsg("手机号格式不对");
            return false;
        }
        if(!cardReg.test(idcard)){
            tipMsg("身份证格式不对");
            return false;
        }
        return true;
    }
</script>
</html>

